import requests


class EmpApi(object):
    @classmethod
    def add_emp(cls, header, js_data):
        url = "http://ihrm-test.itheima.net/api/sys/user"
        resp = requests.post(url=url, headers=header, json=js_data)
        return resp

    @classmethod
    def query_emp(cls, header, my_id):
        url = "http://ihrm-test.itheima.net/api/sys/user/{}".format(my_id)
        resp = requests.get(url=url, headers=header)
        return resp

    @classmethod
    def modify_emp(cls, header, js_data, my_id):
        url = "http://ihrm-test.itheima.net/api/sys/user/{}".format(my_id)
        resp = requests.put(url=url, headers=header, json=js_data)
        return resp

    @classmethod
    def delete_emp(cls, header, my_id):
        url = "http://ihrm-test.itheima.net/api/sys/user/{}".format(my_id)
        resp = requests.delete(url=url, headers=header)
        return resp
